<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="COMM">/**
<span class='line'>  2</span>  * @fileoverview A unit testing suite for Extenscript.
<span class='line'>  3</span>  * @author &lt;a href="mailto:collin.brooks@gmail.com">Collin Brooks&lt;/a>
<span class='line'>  4</span>  * @version 0.1.0 dev
<span class='line'>  5</span>  */</span><span class="WHIT">
<span class='line'>  6</span> 
<span class='line'>  7</span> </span><span class="COMM">/*jslint white: true, onevar: true, undef: true, newcap: true, regexp: true,
<span class='line'>  8</span>  plusplus: true, bitwise: true, maxerr: 50, maxlen: 79, indent: 4 */</span><span class="WHIT">
<span class='line'>  9</span> 
<span class='line'> 10</span> </span><span class="COMM">/**
<span class='line'> 11</span>  * The main testbefore object.
<span class='line'> 12</span>  * @namespace
<span class='line'> 13</span>  * @version 0.1.0 dev
<span class='line'> 14</span>  */</span><span class="WHIT">
<span class='line'> 15</span> </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">TB</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 16</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">data</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 17</span> </span><span class="WHIT">        </span><span class="NAME">tests</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 18</span> </span><span class="WHIT">        </span><span class="NAME">modules</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 19</span> </span><span class="WHIT">        </span><span class="NAME">Module</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 20</span> </span><span class="WHIT">        </span><span class="NAME">Test</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 21</span> </span><span class="WHIT">        </span><span class="NAME">formatter</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 22</span> </span><span class="WHIT">        </span><span class="NAME">equiv</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 23</span> </span><span class="WHIT">        </span><span class="NAME">totalPassed</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 24</span> </span><span class="WHIT">        </span><span class="NAME">totalFailed</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 25</span> </span><span class="WHIT">        </span><span class="NAME">totalModules</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="WHIT">        </span><span class="NAME">totalAssertions</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 27</span> </span><span class="WHIT">        </span><span class="NAME">totalTests</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 28</span> 
<span class='line'> 29</span> </span><span class="WHIT">    </span><span class="NAME">data.currentModule</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 30</span> </span><span class="WHIT">    </span><span class="NAME">data.currentTest</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 31</span> </span><span class="WHIT">    </span><span class="NAME">data.previousModule</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 32</span> 
<span class='line'> 33</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'> 34</span>      * Returns an object with a result and message that describes information
<span class='line'> 35</span>      * about the test.
<span class='line'> 36</span>      * @param {Bool} result The boolean result for the given test.
<span class='line'> 37</span>      * @param {*} actual The actual value of the test.
<span class='line'> 38</span>      * @param {*} expected The expected value of the test.
<span class='line'> 39</span>      * @param {String} message The message to display next to this test result.
<span class='line'> 40</span>      * @returns {Object} An object with result and message keys. The result is
<span class='line'> 41</span>      * a boolean value and the message is a string.
<span class='line'> 42</span>      * @inner
<span class='line'> 43</span>      */</span><span class="WHIT">
<span class='line'> 44</span> </span><span class="WHIT">    </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">assertion</span><span class="PUNC">(</span><span class="NAME">result</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">actual</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">expected</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 45</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">outcome</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 46</span> 
<span class='line'> 47</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 48</span> </span><span class="WHIT">            </span><span class="NAME">result</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">result</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 49</span> </span><span class="WHIT">            </span><span class="NAME">actual</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">actual.toString</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 50</span> </span><span class="WHIT">            </span><span class="NAME">expected</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">expected.toString</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 51</span> </span><span class="WHIT">            </span><span class="NAME">message</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">message</span><span class="WHIT">
<span class='line'> 52</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 53</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 54</span> 
<span class='line'> 55</span> </span><span class="WHIT">    </span><span class="COMM">// Test for equality any JavaScript type.</span><span class="WHIT">
<span class='line'> 56</span> </span><span class="WHIT">    </span><span class="COMM">// Discussions and reference: http://philrathe.com/articles/equiv</span><span class="WHIT">
<span class='line'> 57</span> </span><span class="WHIT">    </span><span class="COMM">// Test suites: http://philrathe.com/tests/equiv</span><span class="WHIT">
<span class='line'> 58</span> </span><span class="WHIT">    </span><span class="COMM">// Author: Philippe Rathé &lt;prathe@gmail.com></span><span class="WHIT">
<span class='line'> 59</span> </span><span class="WHIT">    </span><span class="COMM">// Copied from qunit: http://docs.jquery.com/QUnit</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="WHIT">    </span><span class="NAME">equiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 61</span> 
<span class='line'> 62</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">innerEquiv</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// the real equiv function</span><span class="WHIT">
<span class='line'> 63</span> </span><span class="WHIT">            </span><span class="NAME">callers</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// stack to decide between skip/abort functions</span><span class="WHIT">
<span class='line'> 64</span> </span><span class="WHIT">            </span><span class="NAME">parents</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// stack to avoiding loops from circular referencing</span><span class="WHIT">
<span class='line'> 65</span> </span><span class="WHIT">            </span><span class="NAME">callbacks</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 66</span> 
<span class='line'> 67</span> </span><span class="WHIT">        </span><span class="COMM">// Call the o related callback with the given arguments.</span><span class="WHIT">
<span class='line'> 68</span> </span><span class="WHIT">        </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">bindCallbacks</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callbacks</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 69</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">TB.objectType</span><span class="PUNC">(</span><span class="NAME">o</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">prop</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">TB.objectType</span><span class="PUNC">(</span><span class="NAME">callbacks</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"function"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 72</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">callbacks</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">apply</span><span class="PUNC">(</span><span class="NAME">callbacks</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 73</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 74</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">callbacks</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// or undefined</span><span class="WHIT">
<span class='line'> 75</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 76</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 77</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 78</span> </span><span class="WHIT">        
<span class='line'> 79</span>         </span><span class="NAME">callbacks</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 80</span> 
<span class='line'> 81</span> </span><span class="WHIT">            </span><span class="COMM">// for string, boolean, number and null</span><span class="WHIT">
<span class='line'> 82</span> </span><span class="WHIT">            </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">useStrictEquality</span><span class="PUNC">(</span><span class="NAME">b</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">b</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">a.constructor</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">a</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">b.constructor</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 84</span> </span><span class="WHIT">                    </span><span class="COMM">// to catch short annotaion VS 'new' annotation</span><span class="WHIT">
<span class='line'> 85</span> </span><span class="WHIT">                    </span><span class="COMM">// of a declaration</span><span class="WHIT">
<span class='line'> 86</span> </span><span class="WHIT">                    </span><span class="COMM">// e.g. var i = 1;</span><span class="WHIT">
<span class='line'> 87</span> </span><span class="WHIT">                    </span><span class="COMM">//      var j = new Number(1);</span><span class="WHIT">
<span class='line'> 88</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">b</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 89</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 90</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">b</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 93</span> 
<span class='line'> 94</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 95</span> </span><span class="WHIT">                </span><span class="STRN">"string"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">useStrictEquality</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 96</span> </span><span class="WHIT">                </span><span class="STRN">"boolean"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">useStrictEquality</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 97</span> </span><span class="WHIT">                </span><span class="STRN">"number"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">useStrictEquality</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 98</span> </span><span class="WHIT">                </span><span class="STRN">"null"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">useStrictEquality</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 99</span> </span><span class="WHIT">                </span><span class="STRN">"undefined"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">useStrictEquality</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>100</span> 
<span class='line'>101</span> </span><span class="WHIT">                </span><span class="STRN">"nan"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">b</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>102</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">isNaN</span><span class="PUNC">(</span><span class="NAME">b</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>103</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>104</span> 
<span class='line'>105</span> </span><span class="WHIT">                </span><span class="STRN">"date"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">b</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>106</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">TB.objectType</span><span class="PUNC">(</span><span class="NAME">b</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"date"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>107</span> </span><span class="WHIT">                        </span><span class="NAME">a.valueOf</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">b.valueOf</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>108</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>109</span> 
<span class='line'>110</span> </span><span class="WHIT">                </span><span class="STRN">"regexp"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">b</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>111</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">TB.objectType</span><span class="PUNC">(</span><span class="NAME">b</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"regexp"</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>112</span> </span><span class="WHIT">                        </span><span class="NAME">a.source</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">b.source</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="COMM">// the regex itself</span><span class="WHIT">
<span class='line'>113</span> </span><span class="WHIT">                        </span><span class="NAME">a.global</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">b.global</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="COMM">// and its modifers (gmi) ...</span><span class="WHIT">
<span class='line'>114</span> </span><span class="WHIT">                        </span><span class="NAME">a.ignoreCase</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">b.ignoreCase</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>115</span> </span><span class="WHIT">                        </span><span class="NAME">a.multiline</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">b.multiline</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>116</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>117</span> 
<span class='line'>118</span> </span><span class="WHIT">                </span><span class="COMM">// - skip when the property is a method of an instance (OOP)</span><span class="WHIT">
<span class='line'>119</span> </span><span class="WHIT">                </span><span class="COMM">// - abort otherwise,</span><span class="WHIT">
<span class='line'>120</span> </span><span class="WHIT">                </span><span class="COMM">//   initial === would have catch identical references anyway</span><span class="WHIT">
<span class='line'>121</span> </span><span class="WHIT">                </span><span class="STRN">"function"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>122</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">caller</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">callers</span><span class="PUNC">[</span><span class="NAME">callers.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>123</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">caller</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">Object</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>124</span> </span><span class="WHIT">                        </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">caller</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>125</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>126</span> 
<span class='line'>127</span> </span><span class="WHIT">                </span><span class="STRN">"array"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">b</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>128</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">loop</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>129</span> 
<span class='line'>130</span> </span><span class="WHIT">                    </span><span class="COMM">// b could be an object literal here</span><span class="WHIT">
<span class='line'>131</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">TB.objectType</span><span class="PUNC">(</span><span class="NAME">b</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="STRN">"array"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>132</span> </span><span class="WHIT">                        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>133</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">   
<span class='line'>134</span>                     
<span class='line'>135</span>                     </span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">a.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>136</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">len</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">b.length</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// safe and faster</span><span class="WHIT">
<span class='line'>137</span> </span><span class="WHIT">                        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>138</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>139</span> </span><span class="WHIT">                    
<span class='line'>140</span>                     </span><span class="COMM">//track reference to avoid circular references</span><span class="WHIT">
<span class='line'>141</span> </span><span class="WHIT">                    </span><span class="NAME">parents.push</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>142</span> </span><span class="WHIT">                    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">len</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>143</span> </span><span class="WHIT">                        </span><span class="NAME">loop</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>144</span> </span><span class="WHIT">                        </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">parents.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>145</span> </span><span class="WHIT">                            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">parents</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>146</span> </span><span class="WHIT">                                </span><span class="NAME">loop</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="COMM">//dont rewalk array</span><span class="WHIT">
<span class='line'>147</span> </span><span class="WHIT">                            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>148</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>149</span> </span><span class="WHIT">                        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">loop</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">innerEquiv</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">b</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>150</span> </span><span class="WHIT">                            </span><span class="NAME">parents.pop</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>151</span> </span><span class="WHIT">                            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>152</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>153</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>154</span> </span><span class="WHIT">                    </span><span class="NAME">parents.pop</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>155</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>156</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>157</span> 
<span class='line'>158</span> </span><span class="WHIT">                </span><span class="STRN">"object"</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">b</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>159</span> </span><span class="WHIT">                    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">j</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">loop</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>160</span> </span><span class="WHIT">                        </span><span class="NAME">eq</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// unless we can proove it</span><span class="WHIT">
<span class='line'>161</span> </span><span class="WHIT">                        </span><span class="NAME">aProperties</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">// collection of strings </span><span class="WHIT">
<span class='line'>162</span> </span><span class="WHIT">                        </span><span class="NAME">bProperties</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// collection of strings</span><span class="WHIT">
<span class='line'>163</span> 
<span class='line'>164</span> </span><span class="WHIT">                    </span><span class="COMM">// comparing constructors is more strict than using</span><span class="WHIT">
<span class='line'>165</span> </span><span class="WHIT">                    </span><span class="COMM">// instanceof</span><span class="WHIT">
<span class='line'>166</span> </span><span class="WHIT">                    </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">a.constructor</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">b.constructor</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>167</span> </span><span class="WHIT">                        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>168</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>169</span> 
<span class='line'>170</span> </span><span class="WHIT">                    </span><span class="COMM">// stack constructor before traversing properties</span><span class="WHIT">
<span class='line'>171</span> </span><span class="WHIT">                    </span><span class="NAME">callers.push</span><span class="PUNC">(</span><span class="NAME">a.constructor</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>172</span> </span><span class="WHIT">                    </span><span class="COMM">//track reference to avoid circular references</span><span class="WHIT">
<span class='line'>173</span> </span><span class="WHIT">                    </span><span class="NAME">parents.push</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>174</span> </span><span class="WHIT">                    
<span class='line'>175</span>                     </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>176</span> </span><span class="WHIT">                    </span><span class="COMM">// be strict: don't ensure hasOwnProperty and go deep</span><span class="WHIT">
<span class='line'>177</span> </span><span class="WHIT">                        </span><span class="NAME">loop</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>178</span> </span><span class="WHIT">                        </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">parents.length</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>179</span> </span><span class="WHIT">                            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">parents</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>180</span> </span><span class="WHIT">                                </span><span class="COMM">//don't go down the same path twice </span><span class="WHIT">
<span class='line'>181</span> </span><span class="WHIT">                                </span><span class="NAME">loop</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>182</span> </span><span class="WHIT">                            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>183</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>184</span> </span><span class="WHIT">                        </span><span class="NAME">aProperties.push</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// collect a's properties</span><span class="WHIT">
<span class='line'>185</span> 
<span class='line'>186</span> </span><span class="WHIT">                        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">loop</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="PUNC">!</span><span class="NAME">innerEquiv</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">b</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>187</span> </span><span class="WHIT">                            </span><span class="NAME">eq</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>188</span> </span><span class="WHIT">                            </span><span class="KEYW">break</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>189</span> </span><span class="WHIT">                        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>190</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>191</span> 
<span class='line'>192</span> </span><span class="WHIT">                    </span><span class="NAME">callers.pop</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// unstack, we are done</span><span class="WHIT">
<span class='line'>193</span> </span><span class="WHIT">                    </span><span class="NAME">parents.pop</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>194</span> 
<span class='line'>195</span> </span><span class="WHIT">                    </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="KEYW">in</span><span class="WHIT"> </span><span class="NAME">b</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>196</span> </span><span class="WHIT">                        </span><span class="NAME">bProperties.push</span><span class="PUNC">(</span><span class="NAME">i</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// collect b's properties</span><span class="WHIT">
<span class='line'>197</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>198</span> 
<span class='line'>199</span> </span><span class="WHIT">                    </span><span class="COMM">// Ensures identical properties name</span><span class="WHIT">
<span class='line'>200</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">eq</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT"> </span><span class="NAME">innerEquiv</span><span class="PUNC">(</span><span class="NAME">aProperties.sort</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>201</span> </span><span class="WHIT">                            </span><span class="NAME">bProperties.sort</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>202</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>203</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>204</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>205</span> 
<span class='line'>206</span> </span><span class="WHIT">        </span><span class="NAME">innerEquiv</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT"> </span><span class="COMM">// can take multiple arguments</span><span class="WHIT">
<span class='line'>207</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">args</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Array.prototype.slice.apply</span><span class="PUNC">(</span><span class="NAME">arguments</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>208</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">args.length</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NUMB">2</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>209</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// end transition</span><span class="WHIT">
<span class='line'>210</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>211</span> 
<span class='line'>212</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">b</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>213</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">b</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>214</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// catch the most you can</span><span class="WHIT">
<span class='line'>215</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="WHIT">
<span class='line'>216</span> </span><span class="WHIT">                        </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT">
<span class='line'>217</span> </span><span class="WHIT">                        </span><span class="NAME">b</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT">
<span class='line'>218</span> </span><span class="WHIT">                        </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">a</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT">
<span class='line'>219</span> </span><span class="WHIT">                        </span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">b</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT">
<span class='line'>220</span> </span><span class="WHIT">                        </span><span class="NAME">TB.objectType</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">TB.objectType</span><span class="PUNC">(</span><span class="NAME">b</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>221</span> </span><span class="WHIT">                        </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>222</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="COMM">// don't lose time with error prone cases</span><span class="WHIT">
<span class='line'>223</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>224</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">bindCallbacks</span><span class="PUNC">(</span><span class="NAME">a</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">callbacks</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="NAME">b</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">a</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>225</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>226</span> 
<span class='line'>227</span> </span><span class="WHIT">            </span><span class="COMM">// apply transition with (1..n) arguments</span><span class="WHIT">
<span class='line'>228</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="NAME">args</span><span class="PUNC">[</span><span class="NUMB">0</span><span class="PUNC">]</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">args</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">&&</span><span class="WHIT">
<span class='line'>229</span> </span><span class="WHIT">                    </span><span class="NAME">arguments.callee.apply</span><span class="PUNC">(</span><span class="WHIT">
<span class='line'>230</span> </span><span class="WHIT">                        </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>231</span> </span><span class="WHIT">                        </span><span class="NAME">args.splice</span><span class="PUNC">(</span><span class="NUMB">1</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">args.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>232</span> </span><span class="WHIT">                    </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>233</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>234</span> 
<span class='line'>235</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">innerEquiv</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>236</span> 
<span class='line'>237</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>238</span> 
<span class='line'>239</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>240</span>      * Returns the type of the given object as a lowercase string.
<span class='line'>241</span>      * Borrowed from QUnit: http://docs.jquery.com/QUnit
<span class='line'>242</span>      * @param {Object} obj An object to get the type of.
<span class='line'>243</span>      * @returns {String} A lowercase type string.
<span class='line'>244</span>      */</span><span class="WHIT">
<span class='line'>245</span> </span><span class="WHIT">	</span><span class="NAME">this.objectType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>246</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>247</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="STRN">"undefined"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>248</span> 
<span class='line'>249</span> </span><span class="WHIT">		</span><span class="COMM">// consider: typeof null === object</span><span class="WHIT">
<span class='line'>250</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>251</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>252</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="STRN">"null"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>253</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>254</span> 
<span class='line'>255</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Object.prototype.toString.call</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>256</span> </span><span class="WHIT">			</span><span class="PUNC">.</span><span class="NAME">match</span><span class="PUNC">(</span><span class="REGX">/^\[object\s(.*)\]$/</span><span class="PUNC">)</span><span class="PUNC">[</span><span class="NUMB">1</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>257</span> 
<span class='line'>258</span> </span><span class="WHIT">		</span><span class="KEYW">switch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>259</span> </span><span class="WHIT">            </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'Number'</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>260</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">isNaN</span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>261</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="STRN">"nan"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>262</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>263</span> </span><span class="WHIT">                    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="STRN">"number"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>264</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>265</span> </span><span class="WHIT">            </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'String'</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>266</span> </span><span class="WHIT">            </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'Boolean'</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>267</span> </span><span class="WHIT">            </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'Array'</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>268</span> </span><span class="WHIT">            </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'Date'</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>269</span> </span><span class="WHIT">            </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'RegExp'</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>270</span> </span><span class="WHIT">            </span><span class="KEYW">case</span><span class="WHIT"> </span><span class="STRN">'Function'</span><span class="PUNC">:</span><span class="WHIT">
<span class='line'>271</span> </span><span class="WHIT">                </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">type.toLowerCase</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>272</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>273</span> </span><span class="WHIT">		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">obj</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"object"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>274</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="STRN">"object"</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>275</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>276</span> </span><span class="WHIT">		</span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>277</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>278</span> 
<span class='line'>279</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>280</span>      * @namespace Default formatter object that outputs information
<span class='line'>281</span>      * to the Extendscript console. This can be replaced with a custom
<span class='line'>282</span>      * formatter object to extend the output functionality.
<span class='line'>283</span>      * @private
<span class='line'>284</span>      * @inner
<span class='line'>285</span>      */</span><span class="WHIT">
<span class='line'>286</span> </span><span class="WHIT">    </span><span class="NAME">formatter</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>287</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>288</span>          * Returns a pluralized string.
<span class='line'>289</span>          * @memberOf formatter
<span class='line'>290</span>          */</span><span class="WHIT">
<span class='line'>291</span> </span><span class="WHIT">        </span><span class="NAME">pluralize</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">val</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">base</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">tail</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>292</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">base</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>293</span> 
<span class='line'>294</span> </span><span class="WHIT">            </span><span class="NAME">s</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">></span><span class="WHIT"> </span><span class="NUMB">1</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="NAME">tail</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">""</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>295</span> 
<span class='line'>296</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">s</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>297</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>298</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>299</span>          * Outputs a result.
<span class='line'>300</span>          * @param {String} type A type string that specifies the type of output
<span class='line'>301</span>          * to make.
<span class='line'>302</span>          * @param {Object} d A data object with key/value pairs required
<span class='line'>303</span>          * for the given type.
<span class='line'>304</span>          * @memberOf formatter
<span class='line'>305</span>          */</span><span class="WHIT">
<span class='line'>306</span> </span><span class="WHIT">        </span><span class="NAME">output</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">d</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>307</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">outcome</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>308</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"moduleHeader"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>309</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="NAME">d.moduleName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'>310</span> </span><span class="WHIT">                    </span><span class="STRN">"("</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">this.pluralize</span><span class="PUNC">(</span><span class="NAME">d.numTests</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"test"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"s"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">")"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>311</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="STRN">"================="</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>312</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>313</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"moduleFooter"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>314</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="STRN">"================="</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>315</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="NAME">d.moduleName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" results: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'>316</span> </span><span class="WHIT">                    </span><span class="STRN">"PASSED: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">d.passed</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">", "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'>317</span> </span><span class="WHIT">                    </span><span class="STRN">"FAILED: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">d.failed</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>318</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>319</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"testHeader"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>320</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="NAME">d.testName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">"("</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'>321</span> </span><span class="WHIT">                        </span><span class="NAME">this.pluralize</span><span class="PUNC">(</span><span class="WHIT">
<span class='line'>322</span> </span><span class="WHIT">                            </span><span class="NAME">d.numAssertions</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>323</span> </span><span class="WHIT">                            </span><span class="STRN">"assertion"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="STRN">"s"</span><span class="WHIT">
<span class='line'>324</span> </span><span class="WHIT">                        </span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">")"</span><span class="WHIT">
<span class='line'>325</span> </span><span class="WHIT">                </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>326</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="STRN">"-----------------"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>327</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>328</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"testFooter"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>329</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>330</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="STRN">"-----------------"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>331</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="NAME">d.testName</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">" results: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'>332</span> </span><span class="WHIT">                    </span><span class="STRN">"PASSED: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">d.passed</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">", "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'>333</span> </span><span class="WHIT">                    </span><span class="STRN">"FAILED: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">d.failed</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>334</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="STRN">""</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>335</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"testResult"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>336</span> </span><span class="WHIT">                </span><span class="NAME">outcome</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">d.result</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">?</span><span class="WHIT"> </span><span class="STRN">"PASSED - "</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">"FAILED - "</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>337</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="STRN">" > "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">outcome</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">d.message</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>338</span> 
<span class='line'>339</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">d.expected</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>340</span> </span><span class="WHIT">                    </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="STRN">"\t EXPECTED: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">d.expected</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>341</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>342</span> 
<span class='line'>343</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">d.actual</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>344</span> </span><span class="WHIT">                    </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="STRN">"\t ACTUAL:   "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">d.actual</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>345</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>346</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">type</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"summary"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>347</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="STRN">"##### SUMMARY #####"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>348</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="STRN">"Total Modules: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">totalModules</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>349</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="STRN">"Total Tests: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">totalTests</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>350</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="STRN">"Total Assertions: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">totalAssertions</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>351</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="STRN">"Total Passed: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">totalPassed</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>352</span> </span><span class="WHIT">                </span><span class="NAME">$.writeln</span><span class="PUNC">(</span><span class="STRN">"Total Failed: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">totalFailed</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>353</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>354</span> </span><span class="WHIT">                </span><span class="NAME">alert</span><span class="PUNC">(</span><span class="STRN">"Unsupported result type: "</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="NAME">d.resultType</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>355</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>356</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>357</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>358</span> 
<span class='line'>359</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>360</span>      * Defines a group of tests.
<span class='line'>361</span>      * @class Represents a group of tests.
<span class='line'>362</span>      * @param {String} name The name of this test group.
<span class='line'>363</span>      * @property {String} name The name of this module.
<span class='line'>364</span>      * @property {Array} tests[] An array of Test objects belonging to this
<span class='line'>365</span>      * module.
<span class='line'>366</span>      * @property {Number} passed The number of tests that have passed.
<span class='line'>367</span>      * @property {Number} failed The number of tests that have failed.
<span class='line'>368</span>      * @property {Array} results[] An array of result objects.
<span class='line'>369</span>      * @inner
<span class='line'>370</span>      */</span><span class="WHIT">
<span class='line'>371</span> </span><span class="WHIT">    </span><span class="NAME">Module</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>372</span> </span><span class="WHIT">        </span><span class="NAME">this.name</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">name</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>373</span> </span><span class="WHIT">        </span><span class="NAME">this.tests</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>374</span> </span><span class="WHIT">        </span><span class="NAME">this.passed</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>375</span> </span><span class="WHIT">        </span><span class="NAME">this.failed</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>376</span> </span><span class="WHIT">        </span><span class="NAME">this.results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>377</span> 
<span class='line'>378</span> </span><span class="WHIT">        </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>379</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>380</span> 
<span class='line'>381</span> </span><span class="WHIT">    </span><span class="NAME">Module.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>382</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>383</span>          * Runs the Module's set of tests.
<span class='line'>384</span>          * @returns {Array} An array of result objects.
<span class='line'>385</span>          */</span><span class="WHIT">
<span class='line'>386</span> </span><span class="WHIT">        </span><span class="NAME">run</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>387</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>388</span> </span><span class="WHIT">                </span><span class="NAME">max</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>389</span> </span><span class="WHIT">                </span><span class="NAME">r</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>390</span> </span><span class="WHIT">                </span><span class="NAME">currTest</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>391</span> </span><span class="WHIT">                </span><span class="NAME">j</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>392</span> </span><span class="WHIT">                </span><span class="NAME">numAssertions</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>393</span> </span><span class="WHIT">                </span><span class="NAME">testResult</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>394</span> 
<span class='line'>395</span> </span><span class="WHIT">            </span><span class="NAME">max</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.tests.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>396</span> 
<span class='line'>397</span> </span><span class="WHIT">            </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">max</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>398</span> </span><span class="WHIT">                </span><span class="NAME">totalTests</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>399</span> </span><span class="WHIT">                </span><span class="NAME">currTest</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">this.tests</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>400</span> </span><span class="WHIT">                
<span class='line'>401</span>                 </span><span class="COMM">//Run the test.</span><span class="WHIT">
<span class='line'>402</span> </span><span class="WHIT">                </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">currTest.run</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>403</span> 
<span class='line'>404</span> </span><span class="WHIT">                </span><span class="COMM">//Output the test header.</span><span class="WHIT">
<span class='line'>405</span> </span><span class="WHIT">                </span><span class="NAME">formatter.output</span><span class="PUNC">(</span><span class="STRN">"testHeader"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>406</span> </span><span class="WHIT">                    </span><span class="NAME">testName</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">currTest.title</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>407</span> </span><span class="WHIT">                    </span><span class="NAME">numAssertions</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">currTest.numAssertions</span><span class="WHIT">
<span class='line'>408</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>409</span> 
<span class='line'>410</span> </span><span class="WHIT">                </span><span class="COMM">//In order to calculate the number of assertions within a test,</span><span class="WHIT">
<span class='line'>411</span> </span><span class="WHIT">                </span><span class="COMM">//the output of the results needed to be delayed. Go through</span><span class="WHIT">
<span class='line'>412</span> </span><span class="WHIT">                </span><span class="COMM">//the results array and output the test results one by one.</span><span class="WHIT">
<span class='line'>413</span> </span><span class="WHIT">                </span><span class="NAME">numAssertions</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">currTest.numAssertions</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>414</span> 
<span class='line'>415</span> </span><span class="WHIT">                </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">numAssertions</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">j</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>416</span> </span><span class="WHIT">                    </span><span class="NAME">testResult</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">currTest.results</span><span class="PUNC">[</span><span class="NAME">j</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>417</span> </span><span class="WHIT">                    </span><span class="NAME">this.processResult</span><span class="PUNC">(</span><span class="NAME">testResult</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>418</span> </span><span class="WHIT">                    </span><span class="NAME">formatter.output</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="STRN">"testResult"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>419</span> </span><span class="WHIT">                        </span><span class="NAME">result</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">testResult.result</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>420</span> </span><span class="WHIT">                        </span><span class="NAME">message</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">testResult.message</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>421</span> </span><span class="WHIT">                        </span><span class="NAME">expected</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">testResult.expected</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>422</span> </span><span class="WHIT">                        </span><span class="NAME">actual</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">testResult.actual</span><span class="WHIT">
<span class='line'>423</span> </span><span class="WHIT">                    </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>424</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>425</span> 
<span class='line'>426</span> </span><span class="WHIT">                </span><span class="COMM">//Output the test footer</span><span class="WHIT">
<span class='line'>427</span> </span><span class="WHIT">                </span><span class="NAME">formatter.output</span><span class="PUNC">(</span><span class="STRN">"testFooter"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>428</span> </span><span class="WHIT">                    </span><span class="NAME">testName</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">currTest.title</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>429</span> </span><span class="WHIT">                    </span><span class="NAME">passed</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">currTest.passed</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>430</span> </span><span class="WHIT">                    </span><span class="NAME">failed</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">currTest.failed</span><span class="WHIT">
<span class='line'>431</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>432</span> </span><span class="WHIT">                
<span class='line'>433</span>                 </span><span class="COMM">//Update the pass/fail numbers and store the result</span><span class="WHIT">
<span class='line'>434</span> </span><span class="WHIT">                </span><span class="COMM">//in the module results array.</span><span class="WHIT">
<span class='line'>435</span> </span><span class="WHIT">                </span><span class="COMM">/*this.processResult(r);*/</span><span class="WHIT">
<span class='line'>436</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>437</span> 
<span class='line'>438</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">this.results</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>439</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>440</span> 
<span class='line'>441</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>442</span>          * Adds a test to this module's array of tests.
<span class='line'>443</span>          * @param {Test} t The test to add to this module.
<span class='line'>444</span>          * @returns {Test} The test added to this module.
<span class='line'>445</span>          */</span><span class="WHIT">
<span class='line'>446</span> </span><span class="WHIT">        </span><span class="NAME">addTest</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>447</span> </span><span class="WHIT">            </span><span class="NAME">this.tests.push</span><span class="PUNC">(</span><span class="NAME">t</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>448</span> </span><span class="WHIT">            </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">t</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>449</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>450</span> 
<span class='line'>451</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>452</span>          * Adds the given result to the Module's list of results as well as
<span class='line'>453</span>          * updates the number of passed/failed tests.
<span class='line'>454</span>          * @param {Object} r The result object to process.
<span class='line'>455</span>          * @returns {Module} This Module; useful for chaining.
<span class='line'>456</span>          */</span><span class="WHIT">
<span class='line'>457</span> </span><span class="WHIT">        </span><span class="NAME">processResult</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">r</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>458</span> </span><span class="WHIT">            </span><span class="NAME">this.results.push</span><span class="PUNC">(</span><span class="NAME">r</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>459</span> </span><span class="WHIT">            
<span class='line'>460</span>             </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">r.result</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>461</span> </span><span class="WHIT">                </span><span class="NAME">this.passed</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>462</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>463</span> </span><span class="WHIT">                </span><span class="NAME">this.failed</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>464</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>465</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>466</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>467</span> 
<span class='line'>468</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>469</span>      * Defines a test to be run.
<span class='line'>470</span>      * @class Defines a test, or a collection of assertions.
<span class='line'>471</span>      * @param {String} title The title of this test.
<span class='line'>472</span>      * @param {Function} f The function to call when running this test.
<span class='line'>473</span>      * @property {String} title The title of this test.
<span class='line'>474</span>      * @property {Number} numAssertions The number of assertions within this
<span class='line'>475</span>      * test.
<span class='line'>476</span>      * @property {Function} callback The callback function that is run for this
<span class='line'>477</span>      * test.
<span class='line'>478</span>      * @property {Array} results[] An array of results of the assertions within
<span class='line'>479</span>      * this test.
<span class='line'>480</span>      * @property {Number} passed The number of tests that passed within this
<span class='line'>481</span>      * test.
<span class='line'>482</span>      * @property {Number} failed The number of tests that failed within this
<span class='line'>483</span>      * test.
<span class='line'>484</span>      * @private
<span class='line'>485</span>      * @inner
<span class='line'>486</span>      */</span><span class="WHIT">
<span class='line'>487</span> </span><span class="WHIT">    </span><span class="NAME">Test</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">title</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>488</span> </span><span class="WHIT">        </span><span class="NAME">this.title</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">title</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>489</span> </span><span class="WHIT">        </span><span class="NAME">this.numAssertions</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>490</span> </span><span class="WHIT">        </span><span class="NAME">this.callback</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>491</span> </span><span class="WHIT">        </span><span class="NAME">this.results</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>492</span> </span><span class="WHIT">        </span><span class="NAME">this.passed</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>493</span> </span><span class="WHIT">        </span><span class="NAME">this.failed</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>494</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>495</span> 
<span class='line'>496</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>497</span>      * Runs the test.
<span class='line'>498</span>      */</span><span class="WHIT">
<span class='line'>499</span> </span><span class="WHIT">    </span><span class="NAME">Test.prototype</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>500</span> </span><span class="WHIT">        </span><span class="NAME">run</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>501</span> </span><span class="WHIT">            </span><span class="COMM">/*this.init();*/</span><span class="WHIT">
<span class='line'>502</span> </span><span class="WHIT">            </span><span class="NAME">data.currentTest</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>503</span> </span><span class="WHIT">            </span><span class="NAME">this.callback</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>504</span> </span><span class="WHIT">            </span><span class="COMM">/*this.clean();*/</span><span class="WHIT">
<span class='line'>505</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>506</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>507</span>          * Processes a result from a test.
<span class='line'>508</span>          */</span><span class="WHIT">
<span class='line'>509</span> </span><span class="WHIT">        </span><span class="NAME">processResult</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">r</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>510</span> </span><span class="WHIT">            </span><span class="NAME">this.numAssertions</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>511</span> </span><span class="WHIT">            </span><span class="NAME">totalAssertions</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>512</span> 
<span class='line'>513</span> </span><span class="WHIT">            </span><span class="NAME">this.results.push</span><span class="PUNC">(</span><span class="NAME">r</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>514</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">r.result</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>515</span> </span><span class="WHIT">                </span><span class="NAME">this.passed</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>516</span> </span><span class="WHIT">                </span><span class="NAME">totalPassed</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>517</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>518</span> </span><span class="WHIT">                </span><span class="NAME">this.allPassed</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>519</span> </span><span class="WHIT">                </span><span class="NAME">this.failed</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>520</span> </span><span class="WHIT">                </span><span class="NAME">totalFailed</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>521</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>522</span> 
<span class='line'>523</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>524</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>525</span> 
<span class='line'>526</span> </span><span class="WHIT">    </span><span class="NAME">this.module</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>527</span> </span><span class="WHIT">        </span><span class="NAME">modules.push</span><span class="PUNC">(</span><span class="WHIT">
<span class='line'>528</span> </span><span class="WHIT">            </span><span class="NAME">data.currentModule</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Module</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>529</span> </span><span class="WHIT">        </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>530</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>531</span> 
<span class='line'>532</span> </span><span class="WHIT">    </span><span class="NAME">this.test</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>533</span> </span><span class="WHIT">        </span><span class="COMM">//Check to see if there is a module that exists for this test to be</span><span class="WHIT">
<span class='line'>534</span> </span><span class="WHIT">        </span><span class="COMM">//added to.</span><span class="WHIT">
<span class='line'>535</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">modules.length</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>536</span> </span><span class="WHIT">            </span><span class="COMM">//No module exists, create a main module.</span><span class="WHIT">
<span class='line'>537</span> </span><span class="WHIT">            </span><span class="NAME">modules.push</span><span class="PUNC">(</span><span class="NAME">data.currentModule</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Module</span><span class="PUNC">(</span><span class="STRN">"Main"</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>538</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>539</span> </span><span class="WHIT">        
<span class='line'>540</span>         </span><span class="COMM">//Add the test to the current module</span><span class="WHIT">
<span class='line'>541</span> </span><span class="WHIT">        </span><span class="NAME">modules</span><span class="PUNC">[</span><span class="NAME">modules.length</span><span class="WHIT"> </span><span class="PUNC">-</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">]</span><span class="PUNC">.</span><span class="NAME">addTest</span><span class="PUNC">(</span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">Test</span><span class="PUNC">(</span><span class="NAME">name</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">f</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>542</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>543</span> 
<span class='line'>544</span> </span><span class="WHIT">    </span><span class="NAME">this.runTests</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>545</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">i</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>546</span> </span><span class="WHIT">            </span><span class="NAME">maxModules</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">modules.length</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>547</span> </span><span class="WHIT">            </span><span class="NAME">currModule</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>548</span> </span><span class="WHIT">            </span><span class="NAME">maxTests</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>549</span> 
<span class='line'>550</span> </span><span class="WHIT">        </span><span class="COMM">//Go through all of the modules and run their tests.</span><span class="WHIT">
<span class='line'>551</span> </span><span class="WHIT">        </span><span class="KEYW">for</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">0</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">&lt;</span><span class="WHIT"> </span><span class="NAME">maxModules</span><span class="PUNC">;</span><span class="WHIT"> </span><span class="NAME">i</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>552</span> </span><span class="WHIT">            </span><span class="NAME">data.currentModule</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">currModule</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">modules</span><span class="PUNC">[</span><span class="NAME">i</span><span class="PUNC">]</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>553</span> </span><span class="WHIT">            </span><span class="NAME">totalModules</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NUMB">1</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>554</span> </span><span class="WHIT">            </span><span class="NAME">maxTests</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">currModule.tests.length</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>555</span> </span><span class="WHIT">            
<span class='line'>556</span>             </span><span class="COMM">//Output module name</span><span class="WHIT">
<span class='line'>557</span> </span><span class="WHIT">            </span><span class="NAME">formatter.output</span><span class="PUNC">(</span><span class="STRN">"moduleHeader"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>558</span> </span><span class="WHIT">                </span><span class="NAME">moduleName</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">currModule.name</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>559</span> </span><span class="WHIT">                </span><span class="NAME">numTests</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">maxTests</span><span class="WHIT">
<span class='line'>560</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>561</span> 
<span class='line'>562</span> </span><span class="WHIT">            </span><span class="NAME">currModule.run</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>563</span> 
<span class='line'>564</span> </span><span class="WHIT">            </span><span class="COMM">//Output module footer with results</span><span class="WHIT">
<span class='line'>565</span> </span><span class="WHIT">            </span><span class="NAME">formatter.output</span><span class="PUNC">(</span><span class="STRN">"moduleFooter"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>566</span> </span><span class="WHIT">               </span><span class="NAME">moduleName</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">currModule.name</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>567</span> </span><span class="WHIT">               </span><span class="NAME">passed</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">currModule.passed</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>568</span> </span><span class="WHIT">               </span><span class="NAME">failed</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">currModule.failed</span><span class="WHIT">
<span class='line'>569</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>570</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>571</span> 
<span class='line'>572</span> </span><span class="WHIT">        </span><span class="COMM">//Output a summary of the test.</span><span class="WHIT">
<span class='line'>573</span> </span><span class="WHIT">        </span><span class="NAME">formatter.output</span><span class="PUNC">(</span><span class="STRN">"summary"</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>574</span> </span><span class="WHIT">            </span><span class="NAME">totalModules</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">totalModules</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>575</span> </span><span class="WHIT">            </span><span class="NAME">totalTests</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">totalTests</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>576</span> </span><span class="WHIT">            </span><span class="NAME">totalAssertions</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">totalAssertions</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>577</span> </span><span class="WHIT">            </span><span class="NAME">totalPassed</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">totalPassed</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>578</span> </span><span class="WHIT">            </span><span class="NAME">totalFailed</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">totalFailed</span><span class="WHIT">
<span class='line'>579</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>580</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>581</span> 
<span class='line'>582</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>583</span>      * Asserts true.
<span class='line'>584</span>      * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
<span class='line'>585</span>      */</span><span class="WHIT">
<span class='line'>586</span> </span><span class="WHIT">    </span><span class="NAME">this.ok</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">actual</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>587</span> </span><span class="WHIT">        </span><span class="NAME">data.currentTest.processResult</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>588</span> </span><span class="WHIT">            </span><span class="NAME">result</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">actual</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>589</span> </span><span class="WHIT">            </span><span class="NAME">message</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">message</span><span class="WHIT">
<span class='line'>590</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>591</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>592</span> 
<span class='line'>593</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'>594</span> 	 * Checks that the first two arguments are equal.
<span class='line'>595</span> 	 * Prints out both actual and expected values.
<span class='line'>596</span> 	 *
<span class='line'>597</span> 	 * Prefered to ok( actual == expected, message )
<span class='line'>598</span>      *
<span class='line'>599</span>      * NOTE: This method uses a relaxed comparison (==), for a more strict
<span class='line'>600</span>      * comparison, see {@link TB.strictEqual}
<span class='line'>601</span> 	 *
<span class='line'>602</span>      * @example TB.equal(format("Received {0} bytes.", 2), "Received 2
<span class='line'>603</span>      * bytes.");
<span class='line'>604</span> 	 *
<span class='line'>605</span> 	 * @param {Object} actual The actual value of the assertion.
<span class='line'>606</span> 	 * @param {Object} expected The expected value of the assertion.
<span class='line'>607</span> 	 * @param {String} [message] The message to be displayed for this
<span class='line'>608</span>      * assertion.
<span class='line'>609</span> 	 */</span><span class="WHIT">
<span class='line'>610</span> </span><span class="WHIT">    </span><span class="NAME">this.equal</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">actual</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">expected</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>611</span> </span><span class="WHIT">        </span><span class="NAME">data.currentTest.processResult</span><span class="PUNC">(</span><span class="WHIT">
<span class='line'>612</span> </span><span class="WHIT">            </span><span class="NAME">assertion</span><span class="PUNC">(</span><span class="WHIT">
<span class='line'>613</span> </span><span class="WHIT">                </span><span class="NAME">actual</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">expected</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>614</span> </span><span class="WHIT">                </span><span class="NAME">actual</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>615</span> </span><span class="WHIT">                </span><span class="NAME">expected</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>616</span> </span><span class="WHIT">                </span><span class="NAME">message</span><span class="WHIT">
<span class='line'>617</span> </span><span class="WHIT">            </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>618</span> </span><span class="WHIT">        </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>619</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>620</span> 
<span class='line'>621</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>622</span>      * Checks that the first two arguments are not equal.
<span class='line'>623</span>      * Prints out both actual and expected values.
<span class='line'>624</span>      *
<span class='line'>625</span>      * Prefered to ok(actual != expected, message)
<span class='line'>626</span>      *
<span class='line'>627</span>      * NOTE: This method uses a relaxed comparison (==), for a more strict
<span class='line'>628</span>      * comparison, see (@link TB.strictNotEqual}
<span class='line'>629</span>      *
<span class='line'>630</span>      * @example TB.notEqual(format("Received {0} bytes.", 2), "Received 2
<span class='line'>631</span>      * bytes.");
<span class='line'>632</span> 	 *
<span class='line'>633</span> 	 * @param {Object} actual The actual value of the assertion.
<span class='line'>634</span> 	 * @param {Object} expected The expected value of the assertion.
<span class='line'>635</span> 	 * @param {String} [message] The message to be displayed for this
<span class='line'>636</span>      * assertion.
<span class='line'>637</span>      */</span><span class="WHIT">
<span class='line'>638</span> </span><span class="WHIT">    </span><span class="NAME">this.notEqual</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">actual</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">expected</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>639</span> </span><span class="WHIT">        </span><span class="NAME">data.currentTest.processResult</span><span class="PUNC">(</span><span class="WHIT">
<span class='line'>640</span> </span><span class="WHIT">            </span><span class="NAME">assertion</span><span class="PUNC">(</span><span class="WHIT">
<span class='line'>641</span> </span><span class="WHIT">                </span><span class="NAME">actual</span><span class="WHIT"> </span><span class="PUNC">!=</span><span class="WHIT"> </span><span class="NAME">expected</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>642</span> </span><span class="WHIT">                </span><span class="NAME">actual</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>643</span> </span><span class="WHIT">                </span><span class="NAME">expected</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>644</span> </span><span class="WHIT">                </span><span class="NAME">message</span><span class="WHIT">
<span class='line'>645</span> </span><span class="WHIT">            </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>646</span> </span><span class="WHIT">        </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>647</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>648</span> 
<span class='line'>649</span> </span><span class="WHIT">	</span><span class="COMM">/**
<span class='line'>650</span> 	 * Strictly checks that the first two arguments are equal.
<span class='line'>651</span> 	 * Prints out both actual and expected values.
<span class='line'>652</span> 	 *
<span class='line'>653</span> 	 * Prefered to ok( actual === expected, message )
<span class='line'>654</span>      *
<span class='line'>655</span>      * NOTE: This method uses a strict comparison (===), for a more relaxed
<span class='line'>656</span>      * comparison, see {@link TB.equal}
<span class='line'>657</span> 	 *
<span class='line'>658</span>      * @example TB.strictEqual(format("Received {0} bytes.", 2), "Received 2
<span class='line'>659</span>      * bytes.");
<span class='line'>660</span> 	 *
<span class='line'>661</span> 	 * @param {Object} actual The actual value of the assertion.
<span class='line'>662</span> 	 * @param {Object} expected The expected value of the assertion.
<span class='line'>663</span> 	 * @param {String} [message] The message to be displayed for this
<span class='line'>664</span>      * assertion.
<span class='line'>665</span> 	 */</span><span class="WHIT">
<span class='line'>666</span> </span><span class="WHIT">    </span><span class="NAME">this.strictEqual</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">actual</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">expected</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>667</span> </span><span class="WHIT">        </span><span class="NAME">data.currentTest.processResult</span><span class="PUNC">(</span><span class="WHIT">
<span class='line'>668</span> </span><span class="WHIT">            </span><span class="NAME">assertion</span><span class="PUNC">(</span><span class="WHIT">
<span class='line'>669</span> </span><span class="WHIT">                </span><span class="NAME">actual</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="NAME">expected</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>670</span> </span><span class="WHIT">                </span><span class="NAME">actual</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>671</span> </span><span class="WHIT">                </span><span class="NAME">expected</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>672</span> </span><span class="WHIT">                </span><span class="NAME">message</span><span class="WHIT">
<span class='line'>673</span> </span><span class="WHIT">            </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>674</span> </span><span class="WHIT">        </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>675</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>676</span> 
<span class='line'>677</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>678</span>      * Strictly checks that the first two arguments are not equal.
<span class='line'>679</span>      * Prints out both actual and expected values.
<span class='line'>680</span>      *
<span class='line'>681</span>      * Prefered to ok(actual !== expected, message)
<span class='line'>682</span>      *
<span class='line'>683</span>      * NOTE: This method uses a strict comparison (===), for a more relaxed
<span class='line'>684</span>      * comparison, see (@link TB.notEqual}
<span class='line'>685</span>      *
<span class='line'>686</span>      * @example TB.strictNotEqual(format("Received {0} bytes.", 2), "Received 2
<span class='line'>687</span>      * bytes.");
<span class='line'>688</span> 	 *
<span class='line'>689</span> 	 * @param {Object} actual The actual value of the assertion.
<span class='line'>690</span> 	 * @param {Object} expected The expected value of the assertion.
<span class='line'>691</span> 	 * @param {String} [message] The message to be displayed for this
<span class='line'>692</span>      * assertion.
<span class='line'>693</span>      */</span><span class="WHIT">
<span class='line'>694</span> </span><span class="WHIT">    </span><span class="NAME">this.strictNotEqual</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">actual</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">expected</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>695</span> </span><span class="WHIT">        </span><span class="NAME">data.currentTest.processResult</span><span class="PUNC">(</span><span class="WHIT">
<span class='line'>696</span> </span><span class="WHIT">            </span><span class="NAME">assertion</span><span class="PUNC">(</span><span class="WHIT">
<span class='line'>697</span> </span><span class="WHIT">                </span><span class="NAME">actual</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">expected</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>698</span> </span><span class="WHIT">                </span><span class="NAME">actual</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>699</span> </span><span class="WHIT">                </span><span class="NAME">expected</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>700</span> </span><span class="WHIT">                </span><span class="NAME">message</span><span class="WHIT">
<span class='line'>701</span> </span><span class="WHIT">            </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>702</span> </span><span class="WHIT">        </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>703</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>704</span> 
<span class='line'>705</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>706</span>      * A deep recursive comparison assertion, working on primitive types,
<span class='line'>707</span>      * arrays and objects. Similar to equal, compares the content given
<span class='line'>708</span>      * objects. Its also more strict than equal: Comparisons are done using
<span class='line'>709</span>      * ===.  For a discussion of the concepts and reasons behind the
<span class='line'>710</span>      * implementation, see &lt;a href="http://philrathe.com/articles/equiv">this
<span class='line'>711</span>      * article&lt;/a>.
<span class='line'>712</span>      *
<span class='line'>713</span>      * @param {Object} The object that is the actual resulting object of the
<span class='line'>714</span>      * assertion.
<span class='line'>715</span>      * @param {Object} The object that is the expected resulting object of the
<span class='line'>716</span>      * assertion.
<span class='line'>717</span>      * @param {String} message The message to display with the assertion.
<span class='line'>718</span>      */</span><span class="WHIT">
<span class='line'>719</span> </span><span class="WHIT">	</span><span class="NAME">this.deepEqual</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">actual</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">expected</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>720</span> </span><span class="WHIT">        </span><span class="NAME">data.currentTest.processResult</span><span class="PUNC">(</span><span class="WHIT">
<span class='line'>721</span> </span><span class="WHIT">            </span><span class="NAME">assertion</span><span class="PUNC">(</span><span class="WHIT">
<span class='line'>722</span> </span><span class="WHIT">                </span><span class="NAME">equiv</span><span class="PUNC">(</span><span class="NAME">actual</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">expected</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>723</span> </span><span class="WHIT">                </span><span class="NAME">actual</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>724</span> </span><span class="WHIT">                </span><span class="NAME">expected</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>725</span> </span><span class="WHIT">                </span><span class="NAME">message</span><span class="WHIT">
<span class='line'>726</span> </span><span class="WHIT">            </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>727</span> </span><span class="WHIT">        </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>728</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>729</span> 
<span class='line'>730</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>731</span>      * A deep recursive comparison assertion, working on primitive types,
<span class='line'>732</span>      * arrays and objects. Similar to notEqual, compares the content given
<span class='line'>733</span>      * objects. Its also more strict than notEqual: Comparisons are done using
<span class='line'>734</span>      * ===.  For a discussion of the concepts and reasons behind the
<span class='line'>735</span>      * implementation, see &lt;a href="http://philrathe.com/articles/equiv">this
<span class='line'>736</span>      * article&lt;/a>.
<span class='line'>737</span>      *
<span class='line'>738</span>      * @param {Object} The object that is the actual resulting object of the
<span class='line'>739</span>      * assertion.
<span class='line'>740</span>      * @param {Object} The object that is the expected resulting object of the
<span class='line'>741</span>      * assertion.
<span class='line'>742</span>      * @param {String} message The message to display with the assertion.
<span class='line'>743</span>      */</span><span class="WHIT">
<span class='line'>744</span> </span><span class="WHIT">	</span><span class="NAME">this.notDeepEqual</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">actual</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">expected</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>745</span> </span><span class="WHIT">        </span><span class="NAME">data.currentTest.processResult</span><span class="PUNC">(</span><span class="WHIT">
<span class='line'>746</span> </span><span class="WHIT">            </span><span class="NAME">assertion</span><span class="PUNC">(</span><span class="WHIT">
<span class='line'>747</span> </span><span class="WHIT">                </span><span class="PUNC">!</span><span class="NAME">equiv</span><span class="PUNC">(</span><span class="NAME">actual</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">expected</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>748</span> </span><span class="WHIT">                </span><span class="NAME">actual</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>749</span> </span><span class="WHIT">                </span><span class="NAME">expected</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>750</span> </span><span class="WHIT">                </span><span class="NAME">message</span><span class="WHIT">
<span class='line'>751</span> </span><span class="WHIT">            </span><span class="PUNC">)</span><span class="WHIT">
<span class='line'>752</span> </span><span class="WHIT">        </span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>753</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>754</span> 
<span class='line'>755</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>756</span>      * Asserts that a given object has a method or field with the given
<span class='line'>757</span>      * property name.
<span class='line'>758</span>      * @param {Object} The object to check for a property.
<span class='line'>759</span>      * @param {String} The string name representation of the method or field to
<span class='line'>760</span>      * search the given Object for.
<span class='line'>761</span>      * @param {String} message The message to display with this assertion.
<span class='line'>762</span>      */</span><span class="WHIT">
<span class='line'>763</span> </span><span class="WHIT">    </span><span class="NAME">this.hasProperty</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">prop</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>764</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>765</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">obj</span><span class="PUNC">[</span><span class="NAME">prop</span><span class="PUNC">]</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>766</span> </span><span class="WHIT">            </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">result</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>767</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>768</span> </span><span class="WHIT">            </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">result</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>769</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>770</span> 
<span class='line'>771</span> </span><span class="WHIT">        </span><span class="NAME">data.currentTest.processResult</span><span class="PUNC">(</span><span class="NAME">r</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>772</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>773</span> 
<span class='line'>774</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>775</span>      * Borrowed from Qunit: http://docs.jquery.com/QUnit
<span class='line'>776</span>      * @ignore
<span class='line'>777</span>      */</span><span class="WHIT">
<span class='line'>778</span> </span><span class="WHIT">	</span><span class="NAME">this.raises</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">block</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">expected</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>779</span> </span><span class="WHIT">		</span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">actual</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">ok</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>780</span> </span><span class="WHIT">	
<span class='line'>781</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="KEYW">typeof</span><span class="WHIT"> </span><span class="NAME">expected</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">'string'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>782</span> </span><span class="WHIT">			</span><span class="NAME">message</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">expected</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>783</span> </span><span class="WHIT">			</span><span class="NAME">expected</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">null</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>784</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>785</span> </span><span class="WHIT">	
<span class='line'>786</span> 		</span><span class="KEYW">try</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>787</span> </span><span class="WHIT">			</span><span class="NAME">block</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>788</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">catch</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">e</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>789</span> </span><span class="WHIT">			</span><span class="NAME">actual</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">e</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>790</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>791</span> </span><span class="WHIT">	
<span class='line'>792</span> 		</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">actual</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>793</span> </span><span class="WHIT">			</span><span class="COMM">// we don't want to validate thrown error</span><span class="WHIT">
<span class='line'>794</span> </span><span class="WHIT">			</span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">expected</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>795</span> </span><span class="WHIT">				</span><span class="NAME">ok</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>796</span> </span><span class="WHIT">			</span><span class="COMM">// expected is a regexp	</span><span class="WHIT">
<span class='line'>797</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">TB.objectType</span><span class="PUNC">(</span><span class="NAME">expected</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="STRN">"regexp"</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>798</span> </span><span class="WHIT">				</span><span class="NAME">ok</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">expected.test</span><span class="PUNC">(</span><span class="NAME">actual</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>799</span> </span><span class="WHIT">			</span><span class="COMM">// expected is a constructor	</span><span class="WHIT">
<span class='line'>800</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">actual</span><span class="WHIT"> </span><span class="KEYW">instanceof</span><span class="WHIT"> </span><span class="NAME">expected</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>801</span> </span><span class="WHIT">				</span><span class="NAME">ok</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>802</span> </span><span class="WHIT">            </span><span class="COMM">// expected is a validation function which returns true is</span><span class="WHIT">
<span class='line'>803</span> </span><span class="WHIT">            </span><span class="COMM">// validation passed	</span><span class="WHIT">
<span class='line'>804</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">expected.call</span><span class="PUNC">(</span><span class="PUNC">{</span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">actual</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">===</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>805</span> </span><span class="WHIT">				</span><span class="NAME">ok</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>806</span> </span><span class="WHIT">			</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>807</span> </span><span class="WHIT">		</span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>808</span> </span><span class="WHIT">			
<span class='line'>809</span> 		</span><span class="NAME">TB.ok</span><span class="PUNC">(</span><span class="NAME">ok</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>810</span> </span><span class="WHIT">	</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>811</span> 
<span class='line'>812</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>813</span>      * Asserts that a given object is defined.
<span class='line'>814</span>      * @param {*} test The value to test as being defined.
<span class='line'>815</span>      * @param {String} message The message to display with this assertion.
<span class='line'>816</span>      */</span><span class="WHIT">
<span class='line'>817</span> </span><span class="WHIT">    </span><span class="NAME">this.defined</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">test</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>818</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">r</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>819</span> </span><span class="WHIT">        </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">test</span><span class="WHIT"> </span><span class="PUNC">!==</span><span class="WHIT"> </span><span class="NAME">undefined</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>820</span> </span><span class="WHIT">            </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">result</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">true</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>821</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT"> </span><span class="KEYW">else</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>822</span> </span><span class="WHIT">            </span><span class="NAME">r</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">result</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">:</span><span class="WHIT"> </span><span class="NAME">message</span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>823</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>824</span> 
<span class='line'>825</span> </span><span class="WHIT">        </span><span class="NAME">data.currentTest.processResult</span><span class="PUNC">(</span><span class="NAME">r</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>826</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>827</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>828</span> </span><span class="PUNC">}</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>829</span> </span></pre></body></html>